package com.permission.model;

import com.fasterxml.jackson.annotation.*;
import com.solution.framework.model.BaseBean;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;

/**
* Created with generator tools.
* User: sunguangzhu
* DateTime:2014-04-28 09:39:14
*/
@Entity
@Table(name = "t_p_role_resource")
public class PRoleResource extends BaseBean implements java.io.Serializable {

/**
* 归属角色
*/
private  com.permission.model.PRole pRole;

/**
* 归属资源
*/
private  com.permission.model.PResource pResource;

/** default constructor */
public PRoleResource() {
}

/**
* full constructor
* @param pRole
* @param pResource
*/
public PRoleResource( com.permission.model.PRole pRole, com.permission.model.PResource pResource) {
this.pRole=pRole;
this.pResource=pResource;
}

/**
*  getter
*/
    @JsonManagedReference
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "pRole_id")
    @NotFound(action = NotFoundAction.IGNORE)
    @ForeignKey(name = "fk_proleresource_pRole")
public  com.permission.model.PRole getPRole() {
return this.pRole;
}

/**
* setter
* @param pRole
*/
public void setPRole( com.permission.model.PRole pRole) {
this.pRole = pRole;
}

/**
*  getter
*/
    @JsonManagedReference
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "pResource_id")
    @NotFound(action = NotFoundAction.IGNORE)
    @ForeignKey(name = "fk_proleresource_pResource")
public  com.permission.model.PResource getPResource() {
return this.pResource;
}

/**
* setter
* @param pResource
*/
public void setPResource( com.permission.model.PResource pResource) {
this.pResource = pResource;
}

}
